import request from "@/utils/request.js"

// 获取分类列表
export function getCategories(params) {
    return request({
        method: 'get',
        url: '/categories',
        params
    })
}

// 获取分类数量 
export function categoriesCount(params) {
    return request({
        method: 'get',
        url: '/categories/count',
        params
    })
}

// 获取指定分类
export function assignCate(id) {
    return request({
        method: 'get',
        url: '/categories/' + id
    })
}

// 新建分类
export function addCategories(data) {
    return request({
        method: 'post',
        url: '/categories',
        data
    })
}

// 编辑分类
export function editCategories(data) {
    return request({
        method: 'put',
        url: '/categories/' + data.id,
        data
    })
}

// 删除分类
export function delCategories(id) {
    return request({
        method: 'delete',
        url: '/categories/' + id,

    })
}
